///*
// * Copyright 2012-2019 the original author or authors.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// *      https://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
package filter
//
//import (
//	"github.com/go-spring/spring-boot"
//	"github.com/go-spring/spring-core"
//	"github.com/go-spring/spring-web"
//)
//
//func init() {
//	// 这种方式可以避免使用 export 语法，就像 StringFilter 和 NumberFilter 那样。
//	SpringBoot.RegisterFilter(SpringCore.ObjectBean(new(SingleBeanFilter)))
//}
//
//type SingleBeanFilter struct {
//}
//
//func (f *SingleBeanFilter) Invoke(ctx SpringWeb.WebContext, chain SpringWeb.FilterChain) {
//	ctx.LogInfo("::SingleBeanFilter")
//	method := ctx.Request().Method
//	origin := ctx.Request().Header.Get("Origin")
//	ctx.Header("Access-Control-Allow-Origin", origin)
//	ctx.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id")
//	ctx.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT")
//	ctx.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
//	ctx.Header("Access-Control-Allow-Credentials", "true")
//
//	// 放行所有OPTIONS方法
//	if method == "OPTIONS" {
//		ctx.Abort()
//		//ctx.AbortWithStatus(http.StatusNoContent)
//	}
//	// 处理请求
//	chain.Next(ctx)
//}
